package com.ludomancy.sora;


import com.ludomancy.gamelib.GameApplet;
import com.ludomancy.gamelib.Sound;

public class SoraApp extends GameApplet
{
	public static MainWidget mainWidget;
	public static SoraApp app;
	
	public SoraApp()
	{
		fps = 35;
	}
	
	public void init()
	{
		super.init(new GameTheme());
		app = this;
		
		// preloading
		Sound.soundActivated = true;
		
		// should we load a savegame?
		try
		{
//			Properties props = DataStorage.load("starwave");
//			String levelString = (String)props.get("level");
		}
		catch(Exception e)
		{
		}
		resetGame();
	}
	
	public void resetGame()
	{
		// create the game
		new Game();
		
		// create the UI
		gameCanvas.destroyWidget(mainWidget);
		mainWidget = new MainWidget(null, getBounds());
		gameCanvas.showWidget(mainWidget);
	}
	
	public void restart()
	{
		resetGame();
	}	
}
